﻿using FakeXiecheng.API.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace FakeXiecheng.API.Services
{
    public class MockTouristRouteRepository : ITouristRouteRespository
    {

        private List<TouristRoute> _routes;

        public MockTouristRouteRepository()
        {
            if (_routes == null)
            {
                InitializeTouristRoutes();
            }
        }

        private void InitializeTouristRoutes()
        {
            _routes = new List<TouristRoute>()
            {
                new TouristRoute(){
                    ID=Guid.NewGuid(),
                    Title="黄山",
                    Description="黄山迎客松",
                    OriginaPrice=1299,
                    Features="<p>吃住行游购娱</p>",
                    Fees="<p>交通费用自理</p>",
                    Notes="<p>小心危险</p>"
                },
                  new TouristRoute(){
                    ID=Guid.NewGuid(),
                    Title="华山",
                    Description="华山论剑处",
                    OriginaPrice=1599,
                    Features="<p>吃住行游购娱</p>",
                    Fees="<p>交通费用自理</p>",
                    Notes="<p>小心危险</p>"
                }
            };

        }

        /// <summary>
        /// 获取所有旅游路线
        /// </summary>
        /// <returns></returns>
        /// 
        public TouristRoute GetTouristRoute(Guid touristRouteId)
        {
            return _routes.FirstOrDefault(p => p.ID == touristRouteId);
        }

        /// <summary>
        /// 通过旅游路线ID获取旅游路线信息
        /// </summary>
        /// <param name="touristRouteId"></param>
        /// <returns></returns>
        public IEnumerable<TouristRoute> GetTouristRoutes()
        {
            return _routes;
        }
    }
}
